package com.iwdm.renovation;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import com.iwdm.renovation.ui.FragmentEntity;
import com.iwdm.renovation.ui.SectionsPagerAdapter;
import com.iwdm.renovation.ui.cart.CartFragment;
import com.iwdm.renovation.ui.decoration.DecorationFragment;
import com.iwdm.renovation.ui.designer.DesignerFragment;
import com.iwdm.renovation.ui.electrical_area.ElectricalareaFragment;
import com.iwdm.renovation.ui.furniture.FurnitureFragment;
import com.iwdm.renovation.ui.furniture_area.FurnitureareaFragment;
import com.iwdm.renovation.ui.home.homeFragment;
import com.iwdm.renovation.ui.myhome.myHomeFragment;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ArrayList<FragmentEntity> list = new ArrayList<>();
        list.add(new FragmentEntity("首页", homeFragment.newInstance(2)));
        list.add(new FragmentEntity("小家专属设计师", DesignerFragment.newInstance(1)));
        list.add(new FragmentEntity("装修公司品牌挑选", DecorationFragment.newInstance(1)));
        list.add(new FragmentEntity("家具公司品牌挑选", FurnitureFragment.newInstance(1)));
        list.add(new FragmentEntity("家具区挑选", FurnitureareaFragment.newInstance(2)));
        list.add(new FragmentEntity("家电区挑选", ElectricalareaFragment.newInstance(2)));
        list.add(new FragmentEntity("购物车", new CartFragment()));
        list.add(new FragmentEntity("点亮我的小家", new myHomeFragment(this)));
        SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(list, getSupportFragmentManager());
        ViewPager viewPager = findViewById(R.id.view_pager);
        viewPager.setAdapter(sectionsPagerAdapter);
        TabLayout tabs = findViewById(R.id.tabs);
        tabs.setupWithViewPager(viewPager);
    }
}
